package com.example.administrator.ksf_zty.util;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.Gravity;
import android.widget.Toast;

import com.example.administrator.ksf_zty.R;

/**
 * Created by Administrator on 2018/1/8.
 */

public class Tips {
    public static void show(Context context, CharSequence message) {
        Toast toast = Toast.makeText(context, message, Toast.LENGTH_LONG);
        toast.setGravity(Gravity.CENTER, 0, 150);
        toast.show();
    }

    public static void show(Context context, CharSequence message, int duration) {
        Toast toast = Toast.makeText(context, message, duration);
        toast.setGravity(Gravity.CENTER, 0, 150);
        toast.show();
    }

    public static void alert(Context context, CharSequence Title, CharSequence message) {
        new AlertDialog.Builder(context).setTitle(Title)
                .setMessage(message).setCancelable(false)
                .setIcon(android.R.drawable.ic_dialog_info)
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // 点击“确认”后的操作
                        dialog.dismiss();
                    }
                }).show();
    }

}
